$(function(){
	$("#local_order_datagrid").datagrid({    
	    url:'admin/deliver/getAllTotal.do', 
	    loadMsg:'数据加载中···',
	    fit:'true',
	    idField:'id',
	    pagination:true,
	    rownumbers:true,//行号  
	    checkOnSelect : true,
		selectOnCheck : true,
	    columns:[[
		{
			field : "id",
			hidden : true
		},     
	    {
			field:'customer_no',
			title:'客户编号',
			width:200,
			align:'center'
	    },    
	    {
	    	field:'order_total',
	    	title:'订单数量',
	    	width:200,
	    	align:'center'
	     },{
		    field:'size',
		    title:'操作',
		    width:400,
		    align:'center',
		       formatter: function(value,row,index){
		        	return "<a href='javascript:void(0)' onclick=\"deliverManger('"+row['customer_no']+"')\">管理发货</a>|<a href='javascript:void(0)' onclick=\"showDisDetail('"+row['customer_no']+"')\">查看详情</a>";
		  }}
	    ]],
	    fitColumns:true
	});  	
});

function deliverManger(customer_no){
	$("#deliver_dialog").dialog({    
	    title: '发货',    
	    width: 1520,   
	    maximizable:true,
	    height: 600,    
	    closed: false,    
	    cache: false,
	    iconCls:'icon-lorry',
	    href: 'admin/deliver/subPage?customer_no='+customer_no,    
	    modal: true   
	});    
}
function showDisDetail(customer_no){
	$("#detail_dialog").dialog({    
	    title: '查看订单明细',    
	    width: 700,   
	    maximizable:true,
	    height: 600,    
	    closed: false,    
	    cache: false,
	    iconCls:'icon-eye',
	    href: 'admin/deliver/detailPage?customer_no='+customer_no,    
	    modal: true   
	});    
}
function getTime(old) {
	var date = new Date(old);
	var year = date.getFullYear();
	var month = date.getMonth() + 1;
	if (month < 10)
		month = "0" + month;
	var day = date.getDate();
	if (day < 10)
		day = "0" + day;
	var hour = date.getHours();
	if (hour < 10)
		hour = "0" + hour;
	var minute = date.getMinutes();
	if (minute < 10)
		minute = "0" + minute;
	var seconds = date.getSeconds();
	if (seconds < 10)
		seconds = "0" + seconds;
	var newDate = year + "-" + month + "-" + day + " " + hour + ":" + minute
			+ ":" + seconds;
	return newDate;
}
///**查询条件*/
//function queryLocal(){
//	$("#local_order_datagrid").datagrid({
//		queryParams: {
//			orderNo: $("input[name='localOrderNo']").val(),
//			tmFrom : $("input[name='localTmFrom']").val(),
//			tmTo : $("input[name='localTmTo']").val()
//		}
//	});
//}
//function resetLocal(){
//	$("input[name='localOrderNo']").val("");
//	$("input[name='localTmFrom']").val("");
//	$("input[name='localTmTo']").val("");
//	$("#localTmFrom").datebox("setValue","");
//	$("#localTmTo").datebox("setValue","");
//	queryLocal();
//}
